***Replication materials for Su, Yen-Pin. 2014. "Explaining Electoral Volatility in Latin America: Evidence at the Party Level." Latin American Politics and Society 56 (2): 49-69.

***Table 2 (p. 59)
xtmixed ptyabschange incumb party_year_sincedem avgnat_t1 distinctiveness lgdpgrowth loglinflaprice2 instit_discont2 lgallapher_enpv fearon incumblgdpgrowth incumbloglinflaprice2 incumbinstit2 || ctyid:, || ptyid: incumb party_year_sincedem avgnat_t1, cov(identity)
estimates store means
estat ic

***Figure 1 (p. 60)
xtmixed ptyabschange incumb##c.instit_discont2 party_year_sincedem avgnat_t1 distinctiveness lgdpgrowth loglinflaprice2 lgallapher_enpv fearon incumblgdpgrowth incumbloglinflaprice2 || ctyid:, || ptyid: incumb party_year_sincedem avgnat_t1, cov(identity)
margins incumb, at (instit_discont2=(0(1)3))
marginsplot, xdimension(at(instit_discont2)) recast(line) recastci(rarea)

***Figure 2 (p. 61)
xtmixed ptyabschange incumb##c.instit_discont2 party_year_sincedem avgnat_t1 distinctiveness lgdpgrowth loglinflaprice2 lgallapher_enpv fearon incumblgdpgrowth incumbloglinflaprice2 || ctyid:, || ptyid: incumb party_year_sincedem avgnat_t1, cov(identity)
margins r.incumb, at(instit_discont2=(0(1)3)) contrast(effects nowald) vsquish
marginsplot, recast(line) recastci(rarea) yline(0)

***Table 3 (p. 63)
xtmixed votechangenat incumb party_year_sincedem avgnat_t1 distinctiveness lgdpgrowth loglinflaprice2 instit_discont2 lgallapher_enpv fearon incumblgdpgrowth incumbloglinflaprice2 incumbinstit2 || ctyid:, || ptyid: incumb party_year_sincedem avgnat_t1, cov(identity)
estimates store means
estat ic

***Robustness check (I): Gherghina's measure of electoral volatility (p. 62)
xtmixed birchvolati incumb party_year_sincedem avgnat_t1 distinctiveness lgdpgrowth loglinflaprice2 instit_discont2 lgallapher_enpv fearon incumblgdpgrowth incumbloglinflaprice2 incumbinstit2 || ctyid:, || ptyid: incumb party_year_sincedem avgnat_t1, cov(identity)

***Robustness check (II): Sample of bigger parties (size> 5% vote) (p. 63)
drop if sumtwoelec<10
xtmixed ptyabschange incumb party_year_sincedem avgnat_t1 distinctiveness lgdpgrowth loglinflaprice2 instit_discont2 lgallapher_enpv fearon incumblgdpgrowth incumbloglinflaprice2 incumbinstit2 || ctyid:, || ptyid: incumb party_year_sincedem avgnat_t1, cov(identity)

***Robustness check (IIIa & IIIb): including country-level fixed effects (p. 64)
tab ctyid, gen (ctydum)
xtset ptyid ctyelection
xtregar ptyabschange incumb party_year_sincedem avgnat_t1 distinctiveness lgdpgrowth loglinflaprice2 instit_discont2 lgallapher_enpv fearon incumblgdpgrowth incumbloglinflaprice2 incumbinstit2
xtregar ptyabschange incumb party_year_sincedem avgnat_t1 distinctiveness lgdpgrowth loglinflaprice2 instit_discont2 lgallapher_enpv fearon incumblgdpgrowth incumbloglinflaprice2 incumbinstit2 ctydum1- ctydum17

***Robustness check (IV): foonote #6 (p. 65)
gen logptyabschange=ln(ptyabschange)
xtmixed logptyabschange incumb party_year_sincedem avgnat_t1 distinctiveness lgdpgrowth loglinflaprice2 instit_discont2 lgallapher_enpv fearon incumblgdpgrowth incumbloglinflaprice2 incumbinstit2 || ctyid:, || ptyid: incumb party_year_sincedem avgnat_t1, cov(identity)
